import request from "@/axios/request";
import url from "@/axios/url";
const { mesUrl,adminUrl } = url();

// 导出url
export const exportUrl = `${mesUrl}mesTechnology/export`;

// 分页查询
export function getList(params = {}) {
  return request({
    url: `${mesUrl}mesTechnology/pageList`,
    method: "GET",
    params,
  });
}

// 产品系列-无分页查询
export function mesSeriesList(params = {}) {
  return request({
    url: `${adminUrl}baseSeries/list`,
    method: "GET",
  });
}

// 新增
export function rowCreate(data = {}) {
  return request({
    url: `${mesUrl}mesTechnology`,
    method: "POST",
    data,
  });
}

// 修改
export function mesTechnologyUpdate(data = {}) {
  return request({
    url: `${mesUrl}mesTechnology`,
    method: "PUT",
    data,
  });
}

// 修改
export function rowUpdate(data = {}) {
  return request({
    url: `${mesUrl}mesTechnology`,
    method: "PUT",
    data,
  });
}

// 删除
export function rowDel(id) {
  return request({
    url: `${mesUrl}mesTechnology/${id}`,
    method: "PUT",
  });
}

// 详情
export function rowDetail(id) {
  return request({
    url: `${mesUrl}mesTechnology/info/${id}`,
    method: "GET",
  });
}

// 工艺建模-升级
export function upgrade(id) {
  return request({
    url: `${mesUrl}mesTechnology/upgradeVersionTab/${id}`,
    method: "POST",
  });
}

export function upgradeNew(data) {
  return request({
    url: `${mesUrl}mesTechnology/upgradeNew`,
    method: "POST",
    data
  });
}

// 工艺建模-停用
export function stop(id) {
  return request({
    url: `${mesUrl}mesTechnology/stop/${id}`,
    method: "GET",
  });
}

// 工艺建模-发布
export function publish(id) {
  return request({
    url: `${mesUrl}mesTechnology/publish/${id}`,
    method: "GET",
  });
}

// 工艺建模-历史列表
export function historyList(data) {
  return request({
    url: `${mesUrl}mesTechnology/historyList`,
    method: "POST",
    data,
  });
}

// 查询工艺类别:产品，系列列表
export function getTechnologyTypeList() {
  return request({
    url: `${adminUrl}dict/type/technology_type`,
    method: "GET",
  });
}

// 根据工艺id获取关联工序信息
export function detailList(id) {
  return request({
    url: `${mesUrl}mesTechnologyProcess/detailList/${id}`,
    method: "GET",
  });
}

// 工艺建模关联工序-保存顺序
export function saveProcess(data) {
  return request({
    url: `${mesUrl}mesTechnologyProcess/saveProcess`,
    method: "POST",
    data,
  });
}

// 工艺建模-状态分类数量列表
export function statusList() {
  return request({
    url: `${mesUrl}mesTechnology/statusList`,
    method: "GET",
  });
}

// 是否
export function getYesOrNotList() {
  return request({
    url: `${adminUrl}dict/type/yes_or_not`,
    method: "GET",
  });
}

// 工艺类型
export function getTechnologyType() {
  return request({
    url: `${adminUrl}dict/type/technology_type`,
    method: "GET",
  });
}
